home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5589 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.5 KB  |  63 lines

  1. Path: shell.portal.com!not-for-mail
  2. From: clare@shell.portal.com (Clare Chu)
  3. Newsgroups: comp.lang.c++
  4. Subject: Overloading problem with kernal/Class read/write
  5. Date: 5 Feb 1996 12:41:28 -0800
  6. Organization: Portal Communications Company -- 408/973-9111 (voice) 408/973-8091 (data)
  7. Message-ID: <4f5q1o$5s6@jobe.shell.portal.com>
  8. NNTP-Posting-Host: jobe.shell.portal.com
  9.  
  10.  
  11. Hi, I'm sort of new to C++, so please bear with me.
  12.  
  13. I wrote a little file class that has memberfunctions
  14. "read" and "write".  Those member functions use the
  15. kernal "read" and "write".  However when I try to
  16. link/load my program, the load map complains about
  17. the function signature of the kernal "read" and "write"
  18. as not being defined (it isn't the same signature
  19. as the File Class "read" and "write".
  20.  
  21. I got around this by using "readin" and "writeout"
  22. as my member functions, but somehow this doesn't
  23. satisfy me.  There's got to be a way for me to use
  24. "read" and "write", is there?
  25.  
  26. Can someone explain?  Thanks, Clare
  27. clare@shell.portal.com
  28. --------
  29.  
  30. Here is a snippet of my class:
  31.  
  32. class File {
  33. public:
  34.     File(char *);
  35.     ~File() {}
  36.     int getFileDescriptor();
  37.     int readin(char*, unsigned int);
  38.     int writeout(char* , unsigned int);
  39. private:
  40.     char *path;
  41.     int fd;
  42. };
  43.  
  44. The following member functions.
  45.  
  46. File::readin(char* buf, unsigned int nbytes)
  47. {
  48.         int nread;
  49.         nread = read(fd,buf,nbytes);
  50.         return nread;
  51. }
  52.  
  53. File::writeout(char* buf, unsigned int nbytes)
  54. {
  55.         int nwrite;
  56.         nwrite = write(fd,buf,nbytes);
  57.         return nwrite;
  58. }
  59.  
  60.  
  61.  
  62.  
  63.